/*area相关的请求*/

import request from '@/utils/request.ts'
import {
  reqDeptInfoData,
  reqMenuList,
  SysDept,
} from '@/api/system/dept/type.ts'
import { reqBaseData } from "@/api/type";

enum API {
  DEPT_LIST_URL = '/system/dept/list',
  DEPT_ADD_URL = '/system/dept/add',
  DEPT_EXCLUDE_URL = '/system/dept/list/exclude',
  DEPT_EDIT_URL = '/system/dept/edit',
  DEPT_DELETE_URL = '/system/dept/delete',
  DEPT_INFO_URL = '/system/dept/info',
}

//获取部门列表
export const reqDeptListUrl = (queryParams: any) => {
  return request({
    url: API.DEPT_LIST_URL,
    method: 'get',
    params: queryParams,
  })
}

//添加部门
export const reqDeptAddUrl = (form: any) => {
  return request<any, reqBaseData>({
    url: API.DEPT_ADD_URL,
    method: 'post',
    data: form
  })
}

//排除部门
export const reqDeptExcludeUrl = (deptId: any) => {
  return request({
    url: API.DEPT_EXCLUDE_URL + '/' + deptId,
    method: 'get'
  })
}

//修改部门
export const reqDeptEditUrl = (form: any) => {
  return request<any, reqBaseData>({
    url: API.DEPT_EDIT_URL,
    method: 'put',
    data: form
  })
}

//删除部门
export const reqDeptDeleteUrl = (deptId: any) => {
  return request<any, reqBaseData>({
    url: API.DEPT_DELETE_URL + '/' + deptId,
    method: 'delete',
  })
}

//部门详情
export const reqDeptInfoUrl = (deptId: any) => {
  return request.get<any, reqDeptInfoData>(API.DEPT_INFO_URL + '/' + deptId)
}
